package com.jerry.controller;

import org.springframework.core.io.UrlResource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import java.io.*;
import java.net.MalformedURLException;
import java.util.Date;

/**
 * Created by Shirly on 2016/8/11.
 */
@Controller
public class TestController {
  @RequestMapping("/test")
    public String test(){
        System.out.println("dddddddddddddddddddddddddd");
      return "index";
    }

    public static void main(String[] args) {
        try {
            UrlResource a = new UrlResource("http://www.123.com");
//            Object x[] = new String[3];
//          //  x[0] = new Integer(0);
//            x[0] = new String("1");
//            Boolean c = new Boolean("123");
//            System.out.println(c);
//            System.out.println(c.equals(false));
//            System.out.println(x[0]);
//            System.out.println(Boolean.valueOf("123"));
//            System.out.println(a);
         //   System.out.println(StrictMath.abs(1.322));
            //序列化
            File file =new File("G:/temp");
            FileOutputStream f = new FileOutputStream(file); //创建一个包含恢复对象(即对象进行反序列化信息)的”tmp”数据文件
            ObjectOutputStream s = new ObjectOutputStream(f);
            s.writeObject("Today"); //写入字符串对象;
            s.writeObject(new Date()); //写入瞬态对象;
            s.flush();

            //反序列化
            FileInputStream in = new FileInputStream(file);
            ObjectInputStream d = new ObjectInputStream(in);
            String today = (String)d.readObject(); //恢复对象;
            Date date = (Date)d.readObject();
            System.out.println("-----------:"+today+"-----------"+date);



        } catch (MalformedURLException e) {
            e.printStackTrace();
        }catch (IOException e){
            e.printStackTrace();
        }catch (ClassNotFoundException e){
            e.printStackTrace();
        }
    }
}
